import { SystemSettingDao } from "../../gm_server/dao/SystemSettingDao";
import { RoomModel } from "../../hall_server/model/RoomModel";
import { Logger } from "../engine/utils/Logger";
import { GameConfig } from "./GameConfig";
import { RoomConfig } from "./RoomConfig";

export class RoomMatchConfig {

    public gameType: number;
    public renshu: number;
    public serve: number; //报名费
    public online: number = 0

    private static configList: Array<RoomMatchConfig> = [
    ]

    constructor(gameType: number, serve: number, renshu: number) {
        this.gameType = gameType;
        this.serve = serve
        this.renshu = renshu
    }

    public static async init() {
       
    }

    public static getConfigList() {
        for (let i = 0; i < this.configList.length; i++) {
            let config: RoomMatchConfig = this.configList[i]
            config.online = RoomModel.getRoomOnlineNumByRoomTypeAndGameType(RoomConfig.Room_Type.Match, config.gameType)
        }
        return this.configList
    }


    public static getConfigByGame(gameType: number) {
        let configList: Array<RoomMatchConfig> = this.configList
        for (let i = 0; i < configList.length; i++) {
            let config: RoomMatchConfig = configList[i]
            if (config.gameType == gameType) {
                return config
            }
        }
    }

}